<!--{include(pe_tpl('header.html'));}-->
<div class="right_page">
	<div class="now">
		<a href="javascript:;" class="sel">{$menutitle}<i></i></a>
		<div class="clear"></div>
	</div>
	<form method="post" enctype="multipart/form-data" id="form">
	<div class="right_main">	
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 mab20">
		<tr>
			<td align="right" width="150">显示终端：</td>
			<td>{$ini['ad_client'][$info['ad_client']]['name']}</td>
		</tr>
		<tr>
			<td align="right">广告位置：</td>
			<td>
				<select name="info[ad_position]" class="inputselect">
				<!--{foreach($ini['ad_client'][$info['ad_client']]['list'] as $k=>$v):}-->
				<option value="{$k}" <!--{if($k==$info['ad_position']):}-->selected="selected"<!--{endif;}-->>{$v['name']}{$v['size']}</option>
				<!--{endforeach;}-->
				</select>		
			</td>
		</tr>
		<tr>
			<td align="right">广告图片：</td>
			<td id="album_box">
				<div class="upload_box" style="width:410px;height:180px">
					<img src="{pe_thumb($info['ad_logo'])}" class="upload_img" />
					<input type="hidden" name="info[ad_logo]" value="{$info['ad_logo']}" class="upload_val">
				</div>
			</td>
		</tr>
		<tr>
			<td align="right">链接地址：</td>
			<td><input type="text" name="info[ad_url]" value="{$info['ad_url']}" class="inputall input400" /></td>
		</tr>
		<tr>
			<td align="right">显示顺序：</td>
			<td><input type="text" name="info[ad_order]" value="{$info['ad_order']}" class="inputall input80" /></td>
		</tr>
		<tr>
			<td align="right">开启状态：</td>
			<td class="layui-form">
				<input type="checkbox" name="ad_state" value="1" <!--{if($info['ad_state']):}-->checked<!--{endif;}--> lay-skin="switch" lay-text="开启|关闭" />
			</td>
		</tr>
		</table>
	</div>
	<div class="right_bottom center">
		<input type="hidden" name="pe_token" value="{$pe_token}" />
		<input type="hidden" name="pesubmit" value="{$pe_token}" />
		<input type="button" value="提 交" class="tjbtn">
	</div>
	</form>
</div>
<link rel="stylesheet" href="{$pe['host']}include/plugin/layui/css/layui.css">
<script src="{$pe['host']}include/plugin/layui/layui.js"></script>
<link rel="stylesheet" href="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/style.css">
<script src="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/plupload.min.js"></script>
<script src="{$pe['host']}include/plugin/plupload/{$cache_setting['upload_server']}/upload.js"></script>
<script type="text/javascript">
var category_lists = {$category_list};
$(function(){
	$("#album_box").pe_upload();
	category_show("{$info['category_id']}");
	$(":input[name='info[ad_position]']").change(function(){
		category_show();
	})
	$(":button").click(function(){
		pe_submit("{pe_nowurl()}", function(json){
			if (json.code == 1) pe_open('back', 1000);
		});
	})
})
layui.use(['form'], function(){
	form = layui.form;
});
function category_show(category_id) {
	category_list = category_lists[$(":input[name='info[ad_position]'] option:selected").val()];
	var category_id = category_id ? category_id : 0;
	if (typeof(category_list) == 'object') {
		var html = '<select name="info[category_id]" class="inputselect mal5">';
		html += '<option value="0">= 请选择 =</option>';
		for (var k in category_list) {
			var selected = (category_list[k]['id'] == category_id) ? 'selected="selected"' : "";
			html += '<option value="'+category_list[k]['id']+'" '+selected+'>'+category_list[k]['name']+'</option>';
		}
		html +="</option>";
		$(":input[name='info[ad_position]']").after(html);
	}
	else {
		$(":input[name='info[category_id]']").remove();
	}
}
</script>
<!--{include(pe_tpl('footer.html'));}-->